
<?php


 /**
  * ProductDetails Value Object.
  * This class is value object representing database table ProductDetails
  * This class is intented to be used together with associated Dao object.
  */


class ProductDetails {

    /** 
     * Persistent Instance variables. This data is directly 
     * mapped to the columns of database table.
     */
    var $ProductID;
    var $Manufacturer;
    var $ModelNo;
    var $SerialNo;
    var $CompanyPrice;
    var $CustomerPrice;
    var $TechNotes;



    /** 
     * Constructors.
     * The first one takes no arguments and provides the most simple
     * way to create object instance. The another one takes one
     * argument, which is the primary key of the corresponding table.
     */

    function ProductDetails () {

    }

    /* function ProductDetails ($ProductIDIn) {

          $this->ProductID = $ProductIDIn;

    } */


    /** 
     * Get- and Set-methods for persistent variables. The default
     * behaviour does not make any checks against malformed data,
     * so these might require some manual additions.
     */

    function getProductID() {
          return $this->ProductID;
    }
    function setProductID($ProductIDIn) {
          $this->ProductID = $ProductIDIn;
    }

    function getManufacturer() {
          return $this->Manufacturer;
    }
    function setManufacturer($ManufacturerIn) {
          $this->Manufacturer = $ManufacturerIn;
    }

    function getModelNo() {
          return $this->ModelNo;
    }
    function setModelNo($ModelNoIn) {
          $this->ModelNo = $ModelNoIn;
    }

    function getSerialNo() {
          return $this->SerialNo;
    }
    function setSerialNo($SerialNoIn) {
          $this->SerialNo = $SerialNoIn;
    }

    function getCompanyPrice() {
          return $this->CompanyPrice;
    }
    function setCompanyPrice($CompanyPriceIn) {
          $this->CompanyPrice = $CompanyPriceIn;
    }

    function getCustomerPrice() {
          return $this->CustomerPrice;
    }
    function setCustomerPrice($CustomerPriceIn) {
          $this->CustomerPrice = $CustomerPriceIn;
    }

    function getTechNotes() {
          return $this->TechNotes;
    }
    function setTechNotes($TechNotesIn) {
          $this->TechNotes = $TechNotesIn;
    }



    /** 
     * setAll allows to set all persistent variables in one method call.
     * This is useful, when all data is available and it is needed to 
     * set the initial state of this object. Note that this method will
     * directly modify instance variales, without going trough the 
     * individual set-methods.
     */

    function setAll($ProductIDIn,
          $ManufacturerIn,
          $ModelNoIn,
          $SerialNoIn,
          $CompanyPriceIn,
          $CustomerPriceIn,
          $TechNotesIn) {
          $this->ProductID = $ProductIDIn;
          $this->Manufacturer = $ManufacturerIn;
          $this->ModelNo = $ModelNoIn;
          $this->SerialNo = $SerialNoIn;
          $this->CompanyPrice = $CompanyPriceIn;
          $this->CustomerPrice = $CustomerPriceIn;
          $this->TechNotes = $TechNotesIn;
    }


    /** 
     * hasEqualMapping-method will compare two ProductDetails instances
     * and return true if they contain same values in all persistent instance 
     * variables. If hasEqualMapping returns true, it does not mean the objects
     * are the same instance. However it does mean that in that moment, they 
     * are mapped to the same row in database.
     */
    function hasEqualMapping($valueObject) {

          if ($valueObject->getProductID() != $this->ProductID) {
                    return(false);
          }
          if ($valueObject->getManufacturer() != $this->Manufacturer) {
                    return(false);
          }
          if ($valueObject->getModelNo() != $this->ModelNo) {
                    return(false);
          }
          if ($valueObject->getSerialNo() != $this->SerialNo) {
                    return(false);
          }
          if ($valueObject->getCompanyPrice() != $this->CompanyPrice) {
                    return(false);
          }
          if ($valueObject->getCustomerPrice() != $this->CustomerPrice) {
                    return(false);
          }
          if ($valueObject->getTechNotes() != $this->TechNotes) {
                    return(false);
          }

          return true;
    }



    /**
     * toString will return String object representing the state of this 
     * valueObject. This is useful during application development, and 
     * possibly when application is writing object states in textlog.
     */
    function toString() {

        $out = $out."\nclass ProductDetails, mapping to table ProductDetails\n";
        $out = $out."Persistent attributes: \n"; 
        $out = $out."ProductID = ".$this->ProductID."\n"; 
        $out = $out."Manufacturer = ".$this->Manufacturer."\n"; 
        $out = $out."ModelNo = ".$this->ModelNo."\n"; 
        $out = $out."SerialNo = ".$this->SerialNo."\n"; 
        $out = $out."CompanyPrice = ".$this->CompanyPrice."\n"; 
        $out = $out."CustomerPrice = ".$this->CustomerPrice."\n"; 
        $out = $out."TechNotes = ".$this->TechNotes."\n"; 
        return $out;
    }


    /**
     * Clone will return identical deep copy of this valueObject.
     * Here, the retuned cloned object will also have all its attributes cloned.
     */
    function clone1() {
        $cloned = new ProductDetails();

        $cloned->setProductID($this->ProductID); 
        $cloned->setManufacturer($this->Manufacturer); 
        $cloned->setModelNo($this->ModelNo); 
        $cloned->setSerialNo($this->SerialNo); 
        $cloned->setCompanyPrice($this->CompanyPrice); 
        $cloned->setCustomerPrice($this->CustomerPrice); 
        $cloned->setTechNotes($this->TechNotes); 

        return $cloned;
    }

}

?>
